package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.annotation.AutoFill;
import com.sky.dto.DishDTO;
import com.sky.dto.DishPageQueryDTO;
import com.sky.entity.Dish;
import com.sky.entity.DishFlavor;
import com.sky.enumeration.OperationType;
import com.sky.vo.DishVO;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface DishMapper {
    
    @Select("SELECT COUNT(*) FROM dish WHERE category_id = #{id}")
    public Integer countByCategoryId(Long id);


    /**
     * 插入菜品信息
     * @param dish
     */
    @AutoFill(value= OperationType.INSERT)
    void insertDish(Dish dish);

    /**
     * 菜品信息分页查询
     * @param dishPageQueryDTO
     * @return
     */
    Page<DishVO> pageDish(DishPageQueryDTO dishPageQueryDTO);

    @Select("SELECT * FROM dish WHERE id = #{id}")
    Dish getDishById(Long id);

    List<Dish> listDishByCategoryId( Long categoryId);

    @AutoFill(value= OperationType.UPDATE)
    void updateDish(Dish dish);

    void deleteDish(List<Long> ids);

}
